﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SGS.Utility
{
    public class Common 
    {
        public static List<T> RandomSort<T>(List<T> srcList)
        {
            List<T> srcListClone = new List<T>(srcList); 
             
            List<T> destList = new List<T>(srcListClone.Count);

            Random r = new Random();
            while (srcListClone.Count > 0)
            {
                int idx = r.Next(0, srcListClone.Count);
                T temp = srcListClone[idx];
                srcListClone.RemoveAt(idx);
                destList.Add(temp);
            }

            return destList;
        }

        public static List<int> ArrayConvert( string[] array )
        {
            try
            {
                List<int> list = new List<int>();
                foreach (string s in array)
                {
                    list.Add( Convert.ToInt32( s ) );
                }
                return list;
            }
            catch
            {
                throw;
            }
        }
        
    }

    
}
